#include "includes.h"
#include "pocs.h"
// Forward projection projector.
using namespace std;
void P4fproject(ScanData & s)
{
	int i,j;
	double correc=0, norm=0,x;
	

	for (j=0 ; j < s.Ny ; j++){
		for (i=0;i<s.Nx;i++){
			if (!s.APmask[i][j] && s.CSmask[i][j]) {
				correc = correc + s.dx*s.recon[i][j];
				x = s.xmin + i*s.dx;
				norm = norm + s.dx ;// / sqrt(s.X2- x*x);
			}
		}
		correc = (s.FPdata[j] - correc)/norm;
	
		for (i=0 ; i < s.Nx ; i++){
			x = s.xmin + i*s.dx;
			if (!s.APmask[i][j] && s.CSmask[i][j]){
				s.recon[i][j] = s.recon[i][j] + correc;// / sqrt(s.X2 - x*x);
			}
		}
		correc =0;
		norm = 0;
	}
}
